{__NOLAYOUT__}
<layout name="no_nav" />

<!-- TOPBAR -->
<header class="top-bar flex-row">
  <a class="row-item row-item-auto top-bar-back" href="javascript:window.history.back()">返回</a>
  <h3 class="row-item top-bar-name">个人信心更改</h3>
  <span class="row-item row-item-auto top-bar-menu"></span>
</header>

<form id="form" class="form mg1" method="post" action="{:U('User/modifyPost')}">
  <div class="form-item">
    <input type="text" name="name" readonly="readonly" placeholder="" value="{$user.name}" data-nullmsg="用户名不能为空">
  </div>
  <div class="form-item">
    <input type="text" name="nick_name" placeholder="输入在商城显示的昵称" value="{$user.nick_name}" data-nullmsg="请填写昵称T_T">
  </div>
  <div class="form-item">
    <input type="password" name="old_password" placeholder="输入现在的密码" data-type="*">
  </div>
  <div class="form-item">
    <input type="password" name="password" placeholder="输入要更改的密码" data-type="*">
  </div>
  <div class="form-item">
    <input type="hidden" name="sid" value="{$sid}">
    <button class="btn btn-orange w100 pr-btn" type="submit">保存更改</button>
  </div>
</form>

<script type="text/javascript">
  $(function(){

    var form = $("#form");

    form.on("submit", function(e) {
      e.preventDefault();
      APP.checkForm(form, post);
    });

    function post() {
      var data = $(this).serialize(),
          url = $(this).attr("action");
      $.post(url, data, function(response) {
        APP.alert( response.msg );
      });
    };
  });
</script>